#ifndef STX_ALGORITHM_SWAP_RANGES_HPP
#define STX_ALGORITHM_SWAP_RANGES_HPP

#include <stx/algorithm/common.hpp>
#include <stx/algorithm/swap.hpp>

namespace stx {

template <class ForwardIterator1, class ForwardIterator2>
inline ForwardIterator2
swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2)
{
    for(; first1 != last1; ++first1, ++first2) {
        stx::swap(*first1, *first2);
    }
    return first2;
}

template<class T, std::size_t N>
inline void
swap(T (&a)[N], T (&b)[N])
{
    stx::swap_ranges(a, a + N, b);
}

} // namespace stx

#endif // STX_ALGORITHM_SWAP_RANGES_HPP
